package com.st.chapter01;

import java.util.Scanner;

import org.junit.Test;

public class Test3 {
	public static void main(String[] args) {
		System.out.println("Test3.main()");
	}

	// JUnit 主要用来做单元测试
	// 必须 public void 而且不能有参数
	// 使用JUnit后 起类名就不能用Test
	@Test
	public void test1() {
		System.out.println("Test3.test1()");
	}

	@Test
	public void test2() {
		int num = 3;
	}

	@Test
	public void test3() {
		// a 整数97
		char ch = 'a';
		// 强制类型转换
		// 从大到小强制类型转换可能会丢失精度
		System.out.println((char) (ch + 1));
		System.out.println((int) 3.14);

	}

	@Test
	public void test5() {

		int i = 3;
		i++;
		System.out.println(i++);// 4
		System.out.println(++i);// 6
	}

	@Test
	public void test6() {
		// 短路运算
		int num1 = 1;
		int num2 = 3;
		// System.out.println(num1<0&&num1++<num2);
		// System.out.println(num1<0||num1++<num2);
		System.out.println(num1 < 0 & num1++ < num2);
		System.out.println(num1);
		System.out.println(num2);

	}
	@Test
	public void test7() {
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入成绩:");
		int score = sc.nextInt();
		if(score>100||score<0) {
			System.out.println("非法输入");
			return;
		}
		if(score>=0&&score<60) {
			System.out.println("不合格");
		}
		else if (score>=60&&score<70) {
			System.out.println("及格");
		}
		else if (score>=70&&score<80) {
			System.out.println("一般");
		}
		else if (score>=80&&score<90) {
			System.out.println("良好");
		}
		else if (score>=90&&score<=100) {
			System.out.println("优秀");
		}
	}
}
